<?php

session_start();

require( 'php/user.class.php' );

if ( ! $_SESSION['user'] ){

	if ($_POST['username']) {
		$user = new User($_POST['username'], $_POST['password']);
		if ( $user->exists() ) {
			$_SESSION['user'] = $user;
		} else {
			header('Location: index.php');
		}

	}
} else {
	print "Ok: user logged in.";
}


?>
